/*
 * insertionSort.cpp
 *
 *  Created on: Sep 9, 2012
 *      Author: jeffrey
 */

#include<iostream>
#include"../header/util.h"
using namespace std;
class InsertionSort{
private:
	static void swap(int array[],int i, int j){
		int tmp=array[i];
		array[i]=array[j];
		array[j]=tmp;
	}
public:
	static void sort(int array[], int n){
		for(int i=1;i<n;i++)
			for(int j=i;j>0&&array[j]<array[j-1];j--){
				swap(array,j,j-1);
			}
	}
};

//
//int main(){
//	int array[] = { -90,1,2,-3,3,3,4,204,-5,5,5,6,68,6,10,10,10};
//	InsertionSort::sort(array,sizeof(array)/sizeof(int));
//	UtilFunc::printArray(array,sizeof(array)/sizeof(int));
//}
